#!/usr/bin/python

###############################################################
## Name       : spyg_rtl
## Author     : xiaotu
## Time       : 2022-09-16 05:32:02
## Description:
## 
## 
###############################################################

import sys
import os
import re
import argparse
import math

def input_args_proc():
    global top
    global lst
    parser = argparse.ArgumentParser(description="argparse info")
    parser.add_argument('-o', action='store_true', default=False, help='open this script')
    parser.add_argument('-t', help='top_module')
    parser.add_argument('-f', help='filelist.lst')
    result = parser.parse_args()
    if result.o == True:
        os.system("gvim %s" % __file__)
        sys.exit(0)
    top = result.t
    lst = result.f
pass

def main():
    print("%s is working" % __file__)
    input_args_proc()

    os.environ["SG_LST"] = lst
    os.environ["SG_TOP"] = top
    os.system("spyglass -project /home/ICer/ppu_prj/flow/spyg/spyglass.prj -goals lint/lint_rtl -batch;")

if __name__ == "__main__":
    main()
